package com.bwda.dsrs.filecenter.domain.enums;

/**
 * @description: 策略枚举
 * @author: yym
 * @create: 2019-07-28 10:21
 */

public enum PolicyEnum {
    /**
     * 外发权限枚举
     * 1加解密; 2扫描ID;  3脱敏;4PDF转换;5水印：
     *  1加解密; 2扫描ID;  3脱敏;4PDF转换;5水印：
     */
    encrypt("1", "加解密"),
    SCAN("2", "扫描ID"),
    DESENT("3", "脱敏"),
    TOPDF("4", "PDF转换"),
    PRINT("5", "水印");

    private final String key;
    private final String name;


    PolicyEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    public static String codeOfPolicy(String code){
        for(PolicyEnum policyEnum : values()){
            if(policyEnum.getKey().equals(code)){
                return policyEnum.getName();
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }

    public static void main(String[] args) {
        System.out.println(codeOfPolicy("4"));
    }
}